package org.txazo.pattern.observer;

import java.util.Enumeration;
import java.util.Vector;

public class ConcreteSubject implements Subject {

	private Vector<Observer> observers = new Vector<Observer>();

	@Override
	public void addObserver(Observer observer) {
		observers.addElement(observer);
	}

	@Override
	public void deleteObserver(Observer observer) {
		observers.removeElement(observer);
	}

	@Override
	public void deleteObserver() {
		observers.removeAllElements();
	}

	@Override
	public void notifyObservers(String price) {
		Enumeration<Observer> e = observers.elements();
		while (e.hasMoreElements()) {
			e.nextElement().update(price);
		}
	}

}
